unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Button1: TButton;
    Button2: TButton;
    Label2: TLabel;
    procedure FormActivate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
function Out32(wAddr: Word; bOut: Byte): Byte; stdcall; external 'inpout32.dll';
function Inp32(wAddr: Word): Byte; stdcall; external 'inpout32.dll';

procedure TForm1.FormActivate(Sender: TObject);
begin
 Edit1.Text := '';
 Edit1.SetFocus; 
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 Out32($378,StrToInt(Edit1.Text));
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  Data: Byte;
begin
  Data := Inp32($379);
  label2.caption:='When last read, the port was showing ' +
  IntToStr(( Data and $F8 ));
end;

end.
